{include file="head" /}

{include file="menu" /}


<section id="main-content">
    <section class="wrapper">

		<div class="row">
              <div class="col-lg-8">
				<section class="panel">
                          <header class="panel-heading">
                              添加配置
                          </header>
                          <div class="panel-body">
                              <form class="form-horizontal" role="form" id="formid" action="" method="post">
                                  {if isset($id)}
                                  <input type="hidden" value="{$id}" name="id">
                                  {/if}
                                  <div class="form-group">
                                      <label for="inputEmail1" class="col-lg-2 control-label">配置标识</label>
                                      <div class="col-lg-10">
                                          <input type="text" class="form-control"  name="name" value="{$name?$name:''}">
                                          <p class="help-block">用于函数调用，只能使用英文且不能重复</p>
                                      </div>
                                  </div>
                                  <div class="form-group">
                                      <label for="inputPassword1" class="col-lg-2 control-label">配置标题</label>
                                      <div class="col-lg-10">
                                          <input type="text" class="form-control"  name="title" value="{$title?$title:''}">
                                          <p class="help-block">用于后台显示的配置标题</p>
                                      </div>
                                  </div>
                                  <div class="form-group">
                                      <label for="inputEmail1" class="col-lg-2 control-label">排序</label>
                                      <div class="col-lg-10">
                                          <input type="text" class="form-control" name="sort" value="{$sort?$sort:''}" >
                                          <p class="help-block">用于分组显示的顺序</p>
                                      </div>
                                  </div>
                                  <div class="form-group">
                                      <label for="inputPassword1" class="col-lg-2 control-label">配置类型</label>
                                      <div class="col-lg-10">
                                          <select name="type" id="" class="selectpicker show-tick form-control">
                                            <option {if isset($type) && $type == 1} selected="selected" {/if} value="1">字符</option>
                                            <option {if isset($type) && $type == 2} selected="selected" {/if} value="2">文本</option>
                                          </select>
                                          <p class="help-block">系统会根据不同类型解析配置值</p>
                                      </div>
                                  </div>
                                  <div class="form-group">
                                      <label for="inputPassword1" class="col-lg-2 control-label">配置分组</label>
                                      <div class="col-lg-10">
                                          <select name="group" id="" class="selectpicker show-tick form-control">
                                            <option {if isset($group) && $group == 2} selected="selected" {/if} value="2">参数配置</option>
                                            <option {if isset($group) && $group == 1} selected="selected" {/if} value="1">基本配置</option>
                                          </select>
                                          <p class="help-block">配置分组 用于批量设置 不分组则不会显示在系统设置中</p>
                                      </div>
                                  </div>

                                  <div class="form-group">
                                      <label for="inputEmail1" class="col-lg-2 control-label">说明</label>
                                      <div class="col-lg-10">
                                          <input type="text" class="form-control" name="extra" value="{$extra?$extra:''}" >
                                          <p class="help-block">用于对配置的说明</p>
                                      </div>
                                  </div>

                                  
                                  <div class="form-group">
                                      <div class="col-lg-offset-2 col-lg-10">
                                          <button type="submit" class="btn btn-danger" onclick="return addsetup(this.form);">添加</button>
                                      </div>
                                  </div>
                              </form>
                          </div>
                      </section>
              </div>
		</div>
		

  	</section>
</section>
{include file="foot" /}
<script>

function addsetup(form) {
    var name = form.name.value;
    var title = form.title.value;

    if(!name){
        layer.msg('请输入配置标识');
        return false;
    }
    if(!title){
        layer.msg('请输入配置标题'); 
        return false;
    }
    var formurl = "{:Url('addsetup')}";
    var data = $('#formid').serialize();
    var gourl = "{:Url('deploy')}";

    WPpost(formurl,data,gourl);
    
    return false;
}
</script>